//
//  Home.m
//  盘盈贷1.2
//
//  Created by iOS on 15/3/6.
//  Copyright (c) 2015年 iOS. All rights reserved.
//

#import "Home.h"

@implementation Home
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}
- (instancetype)initWithDictionary:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
       
        self.Title = [dic objectForKey:@"Title"];
        self.Amount = [dic objectForKey:@"Amount"];
        self.LoanRate = [dic objectForKey:@"LoanRate"];
        self.BidAmount = [dic objectForKey:@"BidAmount"];
        self.Limit = [dic objectForKey:@"Limit"];
        self.BidRate = [dic objectForKey:@"BidRate"];
        self.ProductCate = [dic objectForKey:@"ProductCate"];
        self.Order = [[dic objectForKey:@"ProductCate"] objectForKey:@"Order"];
        self.MinBid = [[dic objectForKey:@"ProductCate"] objectForKey:@"MinBid"];
        self.Type = [ NSString stringWithFormat:@"%@", [dic objectForKey:@"Type"]];
        self.Id = [ NSString stringWithFormat:@"%@", [dic objectForKey:@"Id"]];
        self.IsHouseLoan = [NSString stringWithFormat:@"%@", [dic objectForKey:@"IsHouseLoan"]];
        
        self.IsCarLoan = [dic objectForKey:@"IsCarLoan"];
        self.IsGuaranteeLoan = [dic objectForKey:@"IsGuaranteeLoan"];
        self.IsZhiYa = [dic objectForKey:@"IsZhiYa"];
        self.IsInsurance = [dic objectForKey:@"IsInsurance"];
        
        self.bid = [ NSString stringWithFormat:@"%@", [[dic objectForKey:@"ProductCate"] objectForKey:@"Id"]];
    }
    return self;
}
+ (NSMutableArray *)modelsFromDics:(NSArray *)arr
{
    NSMutableArray *modelsArr = [NSMutableArray array];
    
    for (NSDictionary *dic in arr) {
        
        Home *home = [[self alloc] initWithDictionary:dic];
        [modelsArr addObject:home];
        
        
    }
    
    return modelsArr;
    
}

@end
